<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<% 
 /**
  功能名称:个性签名
  创建时间:2010-10-12
  创建人:
**/
%>
<%
String path = request.getContextPath();
%>
<html>
  <head>
    <title>个性签名</title>
	<link href="<%=path %>/css/index_css.css" rel="stylesheet" type="text/css" />
	<script language="javascript" src="<%=path %>/js/syAjax.js"></script>
	<script type="text/javascript">
	//获取中英文混合字符串的长度
	function strlen(str) {      
	    var len = 0;      
	    for (var i = 0; i < str.length; i++) {      
	        if (str.charCodeAt(i) > 255 || str.charCodeAt(i)<0) len += 2; else len ++;      
	    }      
	    return len;      
	}
		
	function updateSign(){
		var sign=document.getElementById("sign").value;
		var signaturestatus='';
		var status=document.getElementById("signaturestatus");
		if(status.checked){
			signaturestatus=status.value;
		}else{
			signaturestatus=0;
		}
		if(strlen(sign)>200)
		{
		  alert("字数过长！");
		  return;
		}
		sign=encodeURI(sign);
		sign=encodeURI(sign);
		syAjax.request("post","<%=path %>/updateSignatureUserAction.action?user.userId=${user.userId}&user.signature="+sign+"&user.signaturestatus="+signaturestatus,"",{success:initSuccessResult,fail:onFail,type:'plain'});
	}
	function initSuccessResult(result)
	{
	  if(result=="true")
	  {
	    alert("修改成功！");
	    window.close();
	  }
	}
	</script>
  </head>
  
  <body bgcolor="#ECE9D8">
    <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top" bgcolor="#ECE9D8"><table width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="1" bgcolor="#FFFFFF"></td>
      </tr>
      <tr>
        <td height="20" align="center" style="font-size: 15px;"><b>个性签名</b></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#ABA899"></td>
      </tr>
      <tr>
        <td height="1" bgcolor="#FFFFFF"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="25" align="left" valign="top" bgcolor="#ECE9D8"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center">
          <textarea rows="5" cols="50" id="sign">${user.signature }</textarea>
        </td>
        <td align="left">&nbsp;</td>
        <td align="left">&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3" align="center" class="tb_11 border_4 f_8">&nbsp;字数限200字内。</td>
        </tr>
      <tr>
        <td colspan="4" align="center"><table width="95%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="1" bgcolor="#ABA899"></td>
          </tr>
          <tr>
            <td height="1" bgcolor="#FFFFFF"></tdw>
          </tr>
        </table></td>
        </tr>
        <tr>
        <td align="center">        	
        <input type="checkBox" id="signaturestatus" name="signaturestatus" value="1" ${sessionScope.UserInfo.signaturestatus eq 1 ? "checked=checked" : null}>自动签名<br>        
        </td>
        </tr>
        <tr>
        <td height="30" colspan="3" align="center"><input type="button" onclick="updateSign();" value="提 交" /></td>
        <td align="left">&nbsp;</td>
      </tr>
      
    </table></td>
  </tr>
</table>
  </body>
</html>